package ar.com.jsejtman.cajugastos2.example.controller;

import ar.com.jsejtman.cajugastos2.example.model.Feriados;
import ar.com.jsejtman.cajugastos2.example.service.IFeriadosService;
import ar.com.jsejtman.common.service.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Bla.
 * 
 * @author smatienzo
 */
@Controller
public class FeriadosController {

	/**
	 * Bla.
	 */
	@Autowired
	private IFeriadosService feriadosService;

	/**
	 * bla.
	 * 
	 * @param model bla.
	 * @return bla.
	 */
	@RequestMapping(value = "/ejemplo.do", method = RequestMethod.GET)
	public final ModelAndView buscar(final ModelMap model) {

		Feriados feriado = null;

		try {
			feriado = this.feriadosService.getFeriado(1);
		} catch (final ServiceException e) {
			e.printStackTrace();
		} catch (final Exception e) {
			e.printStackTrace();
		}

		model.put("descripcion", feriado.getDescripcion());

		return (new ModelAndView("feriado-test", model));
	}
}
